home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77641_SecureLaunch.vbs < prev    next >
Encoding:
Text File  |  2003-02-21  |  1.9 KB  |  49 lines

  1. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  2. ' SecureLaunch.vbs
  3. '    Launch the Web UI for Remote Administration in IE
  4. '
  5. ' Copyright (c) Microsoft Corporation.  All rights reserved.
  6. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  7.  
  8. On Error Resume Next
  9. webSrvName = GetWebSrvNum("Administration")
  10.  
  11. ' Check if the Administration site exists
  12. If Not (webSrvName = 0) Then
  13.     
  14.     ' Get the SSL port for the Admin site
  15.     Set oWebSrv = GetObject("IIS://localhost/w3svc/" & webSrvName)
  16.     sslPort = Split(oWebSrv.SecureBindings(0)(0), ":")
  17.  
  18.     ' Construct the URL    
  19.     Set sysInfo = CreateObject("WinNTSystemInfo")
  20.     strURL = "https://" & sysInfo.ComputerName & ":" & sslPort(1) & "/"
  21.  
  22.     ' Open the URL with IE
  23.     Set WshShell = CreateObject("WScript.Shell")
  24.     strIExploreKey = "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE\"
  25.     strCommand = """" & WshShell.RegRead(strIExploreKey) & """ " & strURL
  26.     WshShell.Run strCommand, 3, FALSE
  27.     
  28. End If
  29.  
  30. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  31. ' GetWebSrvNum
  32. '    Get the number of the web site with the given name
  33. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  34. Function GetWebSrvNum(strWebSiteName)
  35.     On Error Resume Next
  36.     GetWebSrvNum = 0
  37.     
  38.     Const REGKEY_WEBFRAMEWORK = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerAppliance\WebFramework\"
  39.     Set WshShell = CreateObject("WScript.Shell")
  40.     Dim nSiteID : nSiteID = WshShell.RegRead(REGKEY_WEBFRAMEWORK & strWebSiteName & "SiteID")
  41.     If (nSiteID <> 0) Then
  42.         Set oWebSite = GetObject("IIS://localhost/w3svc/" & nSiteID)
  43.         If Err.number = 0 Then
  44.             'The website exists
  45.             GetWebSrvNum = nSiteID
  46.         End If
  47.         Err.Clear
  48.     End If
  49. End Function